package com.example._04interceptor.base.config;

import com.example._04interceptor.base.interceptors.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
 * 拦截器配置 注册
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /*registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/**");*/
        /*registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login");*/
        /*registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/v1/user/login");*/
        /*registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/v1/user/**");*/
        registry.addInterceptor(new MyInterceptor())
                .excludePathPatterns("/v1/user/login")
                .addPathPatterns("/v1/user/**");
    }
}
